<template>
  <div>
    <DetailPage :key="key" v-bind="detailConfig" :model="nowData"></DetailPage>
  </div>
</template>

<script setup lang="ts">
import { onMounted,reactive } from 'vue'
import apiMod from '@/apiMod/index'
import { getAreaObj } from '@/utils/util'
import DetailPage from '@/views/aplid/DetailPage/index.vue'
import {revertUTF8} from '@/views/oneStopOffice/utils/index'
import { detailConfig } from '../config'

type Props = {
  nowRowData?:any;
}
const props = withDefaults(defineProps<Props>(), {
  nowRowData:{}
});
let nowData:any = reactive({
  infoImg:'',
  infoTitle:''
})
let key = ref(1)
const getInitData = ()=> {
      let res = {
        data:props.nowRowData
      }
      let areasInfo: any = getAreaObj(res.data, 'from', 'set')
      res.data.areas= areasInfo.areaIds
			res.data.areasName= areasInfo.names
      if(res.data.infoImg){
        res.data.infoImg = res.data.infoImg.split(",")[0]
      }
      if(res.data.infoContent){
				res.data.infoContent = revertUTF8(res.data.infoContent)
			}
      // 输入框都进行一下解密
      detailConfig.column.forEach(el=>{
        if((!el.type||el.type=='input'||el.type=="text")&& res.data[el.prop]){
          res.data[el.prop] =  revertUTF8(res.data[el.prop])
        }
      })
      nowData = res.data
      key.value = Math.random()
}

onMounted(()=> {
  getInitData()
})


</script>

<style scoped>
.bottom {
  margin-top: 13px;
  line-height: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.detail-label {
  color: #eee;
}

.image {
  width: 90%;
  height: 220px;
  display: block;
}
</style>
